package com.cardone.platform.usercenter.controller;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cardone.context.Contexts;
import com.cardone.common.dto.PaginationDto;
import com.cardone.common.util.ReturnDataUtils;
import com.cardone.context.ContextHolder;
import com.cardone.platform.usercenter.dto.UsDepartmentTranslateDto;
import com.cardone.platform.usercenter.service.UsDepartmentTranslateService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
* 用户部门调动
*
* @author yaohaitao
*/
@Setter
@Slf4j
@Controller
public class UsDepartmentTranslateController {
/**
* 用户部门调动：删除
*
* @param deleteUsDepartmentTranslate
*            用户部门调动对象
* @return 处理结果，json格式
*/
@Deprecated
@RequestMapping(value = { "/usercenter/usDepartmentTranslate/delete.json" }, method = RequestMethod.POST)
@ResponseBody
public Callable<Map<String, Object>> deleteJson(final UsDepartmentTranslateDto deleteUsDepartmentTranslate) {
    return () -> {
    ContextHolder.getBean(UsDepartmentTranslateService.class).deleteByIds(deleteUsDepartmentTranslate);

    return ReturnDataUtils.newMap();
    };
    }

    /**
    * 用户部门调动：编辑
    *
    * @param findUsDepartmentTranslate
    *            用户部门调动对象
    * @return 实体对象集，json格式
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/findById.json" })
    @ResponseBody
    public Callable<Map<String, Object>> findByIdJson(final UsDepartmentTranslateDto findUsDepartmentTranslate, final Model model) {
    return () -> {
    final UsDepartmentTranslateDto usDepartmentTranslate = ContextHolder.getBean(UsDepartmentTranslate
    Service.class).findById(UsDepartmentTranslateDto.class, findUsDepartmentTranslate);

    return ReturnDataUtils.newMap("usDepartmentTranslate", usDepartmentTranslate);
    };
    }

    /**
    * 用户部门调动：分页查询
    *
    * @param paginationUsDepartmentTranslate
    *            用户部门调动对象
    * @return 分页，json格式
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/paginationByLikeCode.json" })
    @ResponseBody
    public Callable<Map<String, Object>> paginationByLikeCodeJson(final UsDepartmentTranslateDto paginationUsDepartmentTranslate) {
    return () -> {
    final PaginationDto
<UsDepartmentTranslateDto> usDepartmentTranslatePagination = ContextHolder.getBean(UsDepartmentTranslate
    Service.class).paginationByLikeCode(UsDepartmentTranslateDto.class, paginationUsDepartmentTranslate);

    return ReturnDataUtils.newMap("usDepartmentTranslatePagination", usDepartmentTranslatePagination);
    };
    }

    /**
    * 用户部门调动：分页查询
    *
    * @param paginationUsDepartmentTranslate
    *            用户部门调动对象
    * @param model
    *            上下文映射
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/pagination.html" })
    public void paginationHtml(final UsDepartmentTranslateDto paginationUsDepartmentTranslate, final Model model) {
    final PaginationDto
<UsDepartmentTranslateDto> usDepartmentTranslatePagination = ContextHolder.getBean(UsDepartmentTranslate
    Service.class).paginationByLikeCode(UsDepartmentTranslateDto.class, paginationUsDepartmentTranslate);

    model.addAttribute("usDepartmentTranslatePagination", usDepartmentTranslatePagination);
    }

    /**
    * 用户部门调动：分页查询
    *
    * @param findUsDepartmentTranslate
    *            用户部门调动对象
    * @param model
    *            上下文映射
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/edit.html" })
    public void editHtml(final UsDepartmentTranslateDto findUsDepartmentTranslate, final Model model) {
    final UsDepartmentTranslateDto usDepartmentTranslate = ContextHolder.getBean(UsDepartmentTranslate
    Service.class).findById(UsDepartmentTranslateDto.class, findUsDepartmentTranslate);

    model.addAttribute("usDepartmentTranslate", usDepartmentTranslate);
    }

    /**
    * 用户部门调动：查询
    *
    * @param findListUsDepartmentTranslate
    *            用户部门调动对象
    * @return 用户部门调动对象集合，json格式
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/findListByLikeCode.json" })
    @ResponseBody
    public Callable<Map<String, Object>> findListByLikeCodeJson(final UsDepartmentTranslateDto findListUsDepartmentTranslate) {
    return () -> {
    final List<UsDepartmentTranslateDto> usDepartmentTranslateList = ContextHolder.getBean(UsDepartmentTranslate
    Service.class).findListByLikeCode(UsDepartmentTranslateDto.class, findListUsDepartmentTranslate);

    return ReturnDataUtils.newMap("usDepartmentTranslate", usDepartmentTranslateList);
    };
    }

    /**
    * 用户部门调动：保存
    *
    * @param saveUsDepartmentTranslate
    *            用户部门调动对象
    * @return 处理结果，json格式
    */
    @Deprecated
    @RequestMapping(value = { "/usercenter/usDepartmentTranslate/save.json" })
    @ResponseBody
    public Callable<Map<String, Object>> saveJson(final UsDepartmentTranslateDto saveUsDepartmentTranslate) {
    return () -> {
    ContextHolder.getBean(UsDepartmentTranslateService.class).saveByIdOrCode(UsDepartmentTranslateDto.class, saveUsDepartmentTranslate);

    return ReturnDataUtils.newMap();
    };
    }
    }
